#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 25;

int n, m;
ll dp[N][N][5][5];  // [stage][humps][y1][y2]

void solve() {
  cin >> n >> m;
  if (m * 2 + 1 > n) {
    cout << 0 << endl;
    return;
  }
  rep(y1, 1, 4) rep(y2, y1 + 1, 4) dp[2][0][y1][y2] = 1;
  rep(i, 3, n) {
    rep(t, 0, m) {
      rep(y1, 1, 4) {
        rep(y2, 1, 4) {
          rep(y3, 1, 4) {
            if (y2 == y3) continue;
            int k = t + (y1 < y2 && y2 > y3 ? 1 : 0);
            dp[i][k][y2][y3] += dp[i - 1][t][y1][y2];
          }
        }
      }
    }
  }
  ll ans = 0;
  rep(y1, 1, 4) rep(y2, 1, y1 - 1) ans += dp[n][m][y1][y2];
  cout << ans << endl;
  return;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  t = 1;
  while (t--) solve();
  return 0;
}